package com.victor.common.constant.state;

/**
 * 数据是否启用
 */
public enum Enabled {
    /**
     * 有资格
     */
    ENABLE(1, "有效"),
    /**
     * 没资格
     */
    DISABLE(0, "无效");
    /**
     * code
     */
    int code;
    /**
     * message
     */
    String message;

    Enabled(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static String valueOf(Integer status) {
        if (status == null) {
            return "";
        } else {
            for (Enabled s : Enabled.values()) {
                if (s.getCode() == status) {
                    return s.getMessage();
                }
            }
            return "";
        }
    }
}
